package com.samsung.controller.route;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.samsung.common.annotation.LoginAuth;
import com.samsung.common.util.BaseUtil;

@Controller
@RequestMapping("/center")
public class CenterController {

	/**
	 * 个人中心统一入口路由
	 * @param request
	 * @param response
	 * @return
	 * @throws Exception
	 */
	@LoginAuth
	@RequestMapping("**")
	public ModelAndView route(HttpServletRequest request, HttpServletResponse response) throws Exception {
		String uri = request.getRequestURI();
		
		if(BaseUtil.isEmpty(uri)) {
			throw new Exception("请求路径不正确");
		}
		uri = uri.substring(uri.indexOf("/center")+7);
		
		return new ModelAndView("forward:" + uri);
	}

}